package eclipse.client.threadpool;

import javax.swing.*;
import eclipse.client.Database;
import eclipse.util.*;

public class ServerCheckThread extends ThreadedTimer 
{
	JLabel lblStatus;
	public ServerCheckThread()
	{
		lblStatus = new JLabel();
		setName("Connection check thread");
		setEnabled(true);
		setInterval(20000);
		start();
	}
	public JLabel getStatusLabel()
	{
		return lblStatus;
	}
	public void tick() 
	{
		if(Database.Socket.isConnected())
		{
			lblStatus.setText("Status: Online");
		}
		else
		{
			lblStatus.setText("Status: Offline");
		}
	}	
}
